FROM node:18-alpine AS builder

WORKDIR /app

COPY package*.json ./

RUN npm install -g pnpm
RUN pnpm install --registry=https://registry.npmmirror.com

COPY . .
RUN npm run build


FROM nginx:1.21

ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY ./nginx.conf /etc/nginx/